package com.huawei;

/**
 * Created by Z-hong on 2024/7/23.
 */
import java.util.*;
public class HJ66 {
    public static class CMD{

        LinkList[] linkLists;
        public CMD(){
            linkLists = new LinkList[26];
        }
        public void add(String str,String value){
            String[] s = str.split(" ");
            int i=0;
            Node node = new Node(s[i]);
            int index = s[i].charAt(0) - 'a';
            LinkList linkList = linkLists[index];
            LinkList ll = new LinkList(node,value);

            if(linkList==null){
                linkLists[index]=ll;
            }else{
                while(linkList.next!=null){
                    linkList=linkList.next;
                }
                linkList.next = ll;
            }
            i++;
            while(s.length>i){
                Node temp = new Node(s[i]);
                node.next=temp;
                node=node.next;
                i++;
            }
        }

        public String getString(String str){
            String res="unknown command";
            int res_count=0;
            String[] s = str.split(" ");
            int index = s[0].charAt(0) - 'a';
            LinkList linkList = linkLists[index];
            while(linkList!=null){
                Node node=linkList.node;
                boolean while_flag=true;
                for (int i = 0; i < s.length; i++) {
                    if(node==null) {
                        while_flag=false;
                        break;
                    }
                    boolean for_flag=true;
                    char[] arr_s = s[i].toCharArray();
                    char[] arr_n = node.str.toCharArray();
                    for (int j = 0; j < arr_s.length; j++) {
                        if(arr_s[j]!=arr_n[j]){
                            for_flag=false;
                            break;
                        }
                    }
                    if(for_flag){
                        node=node.next;
                    }else{
                        while_flag=false;
                        break;
                    }
                }
                if(node!=null){
                    while_flag=false;
                }
                if(while_flag){
                    res= linkList.res;
                    res_count++;
                }
                linkList=linkList.next;
            }
            if(res_count!=1){res="unknown command";}
            return res;
        }
    }

    public static class LinkList{
        Node node;
        String res;
        LinkList next;
        public LinkList(Node node,String value){
            this.node=node;
            this.res=value;
        }
    }
    public static class Node{
        String str;
        Node next;

        public Node(String str){
            this.str = str;
        }
    }
    public static void main(String[] args) {

        CMD cmd = new CMD();
        cmd.add("reset","reset what");
        cmd.add("reset board","board fault");
        cmd.add("board add","where to add");
        cmd.add("board delete","no board at all");
        cmd.add("reboot backplane","impossible");
        cmd.add("backplane abort","install first");

        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String str = sc.nextLine();
            System.out.println(cmd.getString(str));
        }
    }
}
